package com.jiezuo.flowable.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiezuo.common.util.StringUtil;
import com.jiezuo.flowable.entity.MyGroup;
import com.jiezuo.flowable.mapper.MyGroupMapper;
import com.jiezuo.flowable.service.MyGroupService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @description 流程用户组
 * @author 庞留杰
 * @date 2023/08/17 15:16
 * @version V1.0
 **/
@Transactional
@Slf4j
@Service
public class MyGroupServiceImpl extends ServiceImpl<MyGroupMapper, MyGroup> implements MyGroupService {

    @Autowired
    MyGroupMapper mapper;

    @Override
    public IPage<MyGroup> findPage(Page initMpPage, MyGroup myGroup) {
        IPage page = mapper.findList(initMpPage,myGroup);
        return page;
    }

    @Override
    public List<MyGroup> findList(MyGroup myGroup) {
        List<MyGroup> list = mapper.findList(myGroup);
        return list;
    }

    @Override
    public MyGroup findById(String id) {
        return this.getById(id);
    }

    @Override
    public boolean add(MyGroup myGroup) {
        return this.save(myGroup);
    }

    @Override
    public boolean update(MyGroup myGroup) {
        return this.updateById(myGroup);
    }

    @Override
    public boolean delete(String id) {
        MyGroup myGroup = new MyGroup();
        myGroup.setId(id);
        myGroup.setIs_delete("1");
        return this.updateById(myGroup);
    }
}
